package yawning.mew.character;

import java.util.HashMap;
import java.util.Map;

public enum Race {
	HUMAN("Human", 1, 20, 20, 20, 20, 20),
	DWARF("Dwarf", 3, 25, 16, 21, 19, 19),
	NIGHT_ELF("Night Elf", 4,  16, 24, 20, 20, 20),
	GNOME("Gnome", 7, 15, 22, 20, 23, 20),
	DRAENEI("Draenei", 11, 21, 17, 20, 20, 22),
	WORGEN("Worgen", 22, 23, 22, 20, 16, 19),
	ORC("Orc", 2, 23, 17, 21, 17, 22),
	UNDEAD("Undead", 5, 19, 18, 20, 18, 25),
	TAUREN("Tauren", 6, 25, 16, 21, 16, 22),
	TROLL("Troll", 8, 21, 22, 20, 16, 21),
	BLOOD_ELF("Blood Elf", 10, 17, 22, 20, 23, 18),
	GOBLIN("Goblin", 9, 17, 22, 20, 23, 18);

	public static Race get(String name) {
		return valueOf(new String(name).toUpperCase().replace(' ', '_'));
	}

	public static Race get(int i) {
		if (sRaceMap.size() == 0) {
			synchronized (sRaceMap) {
				if (sRaceMap.size() == 0) {
					for (Race r : values()) sRaceMap.put(r.mRid, r);
				}
			}
		}
		return sRaceMap.get(i);
	}

	private final String mName;
	private final int mRid;
    private final int mStrength;
    private final int mAgility;
    private final int mStamina;
    private final int mIntellect;
    private final int mSpirit;

	private Race(String name, int id, int str, int agi, int sta, int inte, int spi) {
		mName = name;
		mRid = id;
		mStrength = str;
		mAgility = agi;
		mStamina = sta;
		mIntellect = inte;
		mSpirit = spi;
	}

	@Override
	public String toString() {
		return mName;
	}

	public int getId() {
		return mRid;
	}

	public int getBaseStrength() {
		return mStrength;
	}

	public int getBaseAgility() {
		return mAgility;
	}

	public int getBaseStamina() {
		return mStamina;
	}

	public int getBaseIntellect() {
		return mIntellect;
	}

	public int getBaseSpirit() {
		return mSpirit;
	}

	private static Map<Integer,Race> sRaceMap = new HashMap<Integer,Race>();
}
